<template>
    <div class="shelf-number-row">
    <span class="line">{{ line }}</span>
    <el-button class="copy-button" @click="copyToClipboard">复制</el-button>
  </div>
</template>

<script>
export default {
    props: {
        line: String
    },
    methods: {
        copyToClipboard() {
            const el = document.createElement('textarea');
            el.value = this.line;
            document.body.appendChild(el);
            el.select();
            document.execCommand('copy');
            document.body.removeChild(el);
            this.$message.success('复制成功！');
        }
    }
}
</script>
<style>
.shelf-number-row {
    display: flex;
    align-items: center;
}

.line {
  max-width: 200px;
    flex-grow: 1;
    /* 占据剩余空间 */
}

.copy-button {
    margin-top: 15px;
    /* 调整按钮间距 */
    /* 其他样式 */
}
</style>
